<?php namespace App\Controllers\Manager;

//http://www.codeforest.net/laravel4-simple-website-with-backend-1
 
use App\Models\ProductImageType;
use Input, Redirect, Sentry, Str;
use Notification;
 
class ProductImageTypesController extends \BaseController {
 
    public function index()
    {
        return \View::make('manager.productimagetypes.index')
           ->with('productimagetypes', ProductImageType::all());
    }
 
    public function show($id)
    {
        return \View::make('manager.productimagetypes.show')
            ->with('productimagetype', ProductImageType::find($id));
    }
 
    public function create()
    {
        return \View::make('manager.productimagetypes.create');
    }
 
    public function store()
    {
        $productimagetype = new ProductImageType;
        $productimagetype->type   = Input::get('type');
        $productimagetype->save();

        Notification::success('The product image type was saved.');
     
        return Redirect::route('manager.productimagetypes.index');
    }
 
    public function edit($id)
    {
        return \View::make('manager.productimagetypes.edit')
            ->with('productimagetype', ProductImageType::find($id));
    }
 
    public function update($id)
    {
        $productimagetype = ProductImageType::find($id);
        $productimagetype->type   = Input::get('type');
        $productimagetype->save();

        Notification::success('The product image type was saved.');
     
        return Redirect::route('manager.productimagetypes.edit', $productimagetype->id);
    }
 
    public function destroy($id)
    {
        $productimagetype = ProductImageType::find($id);
        $productimagetype->delete();

        Notification::info('The product image type was deleted.');

        return Redirect::route('manager.productimagetypes.index');
    }
}